
#include "environment.hpp"

#include <sys/ioctl.h>
#include <unistd.h>

Forte::Environment const& Forte::Environment::Get()
{
  static Forte::Environment* Env = NULL;
  if (NULL == Env)
  {
    Env = new Forte::Environment();

    // terminal dimensions
    struct ttysize tty_size;
    ioctl(STDOUT_FILENO, TIOCGWINSZ, &tty_size);
    Env->mTerminalHeight = tty_size.ts_lines;
    Env->mTerminalWidth = tty_size.ts_cols;
  }
  return *Env;
}

